/*******************************************************************************
 * StandardHistoryManager.h
 *
 * Copyright (c) 2012, Varuna L Amachi. All rights reserved.
 *
 * This program/library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This program/library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 ******************************************************************************/

#ifndef STANDARDHISTORYMANAGER_H
#define STANDARDHISTORYMANAGER_H

#include "core/components/AbstractHistoryManager.h"


namespace Tanyatu
{
namespace Component
{
class TANYATU_CORE_EXPORT StandardHistoryManager : public AbstractHistoryManager
{
    Q_OBJECT

protected:


public:
    explicit StandardHistoryManager( QObject *parent = 0 );

    void onItemPlayed( Tanyatu::Model::MediaItem *item );

    void onItemRemovalFromStorage( QString itemId );

    void clear();

    void getHistoryItemIds( QList< QString > &ids ) const;

    int rowCount(const QModelIndex &parent) const;

    int columnCount(const QModelIndex &parent) const;

    QVariant data(const QModelIndex &index, int role) const;

    QVariant headerData(
            int section, Qt::Orientation orientation, int role) const;

    QModelIndex index(int row, int column, const QModelIndex &parent) const;

    QModelIndex parent(const QModelIndex &child) const;

    bool hasChildren(const QModelIndex &parent) const;

    QString uniqueName() const;

    QString module()  const;

    QString displayName() const;

    bool init();

    static QString COMPONENT_NAME;

    static QString COMPONENT_MODULE;

private:
    QList< QPair< QString, QDateTime > *> m_history;

    void clearStruct();
};
}
}

#endif // STANDARDHISTORYMANAGER_H
